/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.data.hibernate;

import cassys.data.UserRoleMappingDAO;
import cassys.domain.user.UserRoleMapping;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
/**
 *
 * @author UserRoleMapping
 */
public class UserRoleMappingHibernateDAO extends GenericHibernateDAO<UserRoleMapping, Long>
        implements UserRoleMappingDAO {

    @Override
    public List<UserRoleMapping> getUser(String userId,String password) throws Exception{

        try {
            Criteria query = super.getSession().createCriteria(UserRoleMapping.class)
                    .createAlias("userSeqNo", "user")
                    .add(Restrictions.eq("user.userId", userId))
                    .add(Restrictions.eq("user.password", password))
                    .add(Restrictions.eq("user.delInd", 0));
             
            List<UserRoleMapping> userRoleList = query.list();
            return userRoleList;
        } catch (Exception e) {
            
            System.out.println(e.getMessage());
            System.out.println("DB not Exists");
            e.printStackTrace();
            throw e;
          //  throw new HibernateAccessLayerException(t.toString());
        }

        
    }
}
